﻿var mongoose = require('mongoose')
mongoose.connect('mongodb://localhost:27017/zanime', { useMongoClient: true })
//193.112.97.63
var Schema = mongoose.Schema

var userSchema = new Schema({
   uid:Number,
   username:String,
   password:String, 
   name:String, 
   time:String, //时间
   imgSrc:String,  // 头像
   exp:Number,
   adminkey:String,
   userType:Number, // 用户类型
   lastLogin:String,
   clientIp:String,
   address:String,
   innerIp:String,
   online:String,
   chatMessage:[{ // 聊天历史记录
      _id:String,
      history:[{
         content:String,
         msgType:Number,
         time:String,
         read:Number
      }]
   }]
});

// 表单
var Users = mongoose.model('Users', userSchema)


// 直接导出模型构造函数
module.exports = Users